Main
2021-01-03

Audio volume in Anki

TL;DR: Install mpv and put volume=80 into ~/.local/share/Anki2/mpv.conf to set the audio volume of Anki to 80%.

Audio volume handling is pretty high in my list of "annoying things I can't believe are still an issue". Whenever I listen to music or watch video there's a high chance, I have to either turn up the volume to hear something. Not much later some other application plays audio with a much higher volume resulting in me worrying whether I just woke up the neighbors. Sadly a lot of applications don't even have a volume setting…

One of those applications is Anki. Since I use it a lot I decided to fix this and a few other things that bug me by writing according plugins. Since I searched the internet several times for any existing ways to set the volume I was surprised when while writing a plugin for it, I found that there is an easy – but undocumented – way to set the playback volume for Anki. At least if you use Linux and have mpv installed. Mpv is one of a hand full of multimedia players that Anki can use for playback. Anki will run a mpv instance as daemon in the background and control it via IPC. MPV is started with the option --config-dir=<ankidir> this way mpv will ignore you default configuration file and search in the Anki directory instead. So you can create a mpv configuration file in this option and in that among other things set the volume or enable audio filters. I set the volume to a level compatible with my other applications. If that's not enough – for example because the audio files in you Anki decks have different volumes – you could enable a dynamic range compression filter.

I still consider writing a simple Anki plugin to set the volume since I suggest more people could use that. For now, I am satisfied with the existing solution and can next try to find a solution to set the volume for websites like Duolingo that also miss a volume setting…

PS: I also considered writing a PulseAudio module to fix this problem in general, but the documentation is spare and is seemed like a bigger project.

en audio anki


Creative Commons License Audio volume in Anki by Michael F. Schönitzer is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.